﻿using System;
using Glue.Converters;
using Xunit;

namespace GlueTests.BaseConverterTests
{
    public class When_inheriting
    {
        private readonly Converter converter;

        public class Converter : BaseConverter<String, int>
        {
            public override int MapTowardsRight(string from, int to)
            {
                return 1;
            }

            public override string MapTowardsLeft(int from, string to)
            {
                return "1";
            }
        }

        public When_inheriting()
        {
            converter = new Converter();
        }

        [Fact]
        public void Should_report_Types()
        {
            Assert.Equal(typeof(String), converter.LeftType);
            Assert.Equal(typeof(int), converter.RightType);
        }

        [Fact]
        public void Should_map_correctly()
        {
            Assert.Equal(1, converter.Map("", 0));
            Assert.Equal("1", converter.Map(0, null));
        }
    }
}
